package com.ai.controller.made.ai_api;


import com.ai.annotation.EnterPathParamLog;
import com.ai.common.CommonResponse;
import com.ai.entity.made.camera.CameraIdBO;
import com.ai.entity.network.L1ToIdentifySysMessage;
import com.ai.model.vo.BatchOperateCameraParam;
import com.ai.service.made.AlgorithmCameraService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 算法接口----摄像头开关算法
 * @author jiaok
 * @since 2023-04-03 21:17:12
 */
@RestController
@RequestMapping("/algorithmAPI/camera")
@Slf4j
public class CameraAPI {

    @Resource
    AlgorithmCameraService algorithmCameraService;
    /**
     * 打开摄像头
     */
    @PostMapping("onOpen")
    @ApiOperation("打开摄像头")
    @EnterPathParamLog
    public CommonResponse onOpen(@RequestBody CameraIdBO cameraIdBO) {
        CommonResponse resultData = algorithmCameraService.onOpen(cameraIdBO);
        log.info(resultData.toString());
        return resultData;
    }

    @PostMapping("batchOpening")
    @ApiOperation("批量开启摄像头")
    @EnterPathParamLog
    public CommonResponse batchOpening(@RequestBody BatchOperateCameraParam batchOperateCameraParam) {
        CommonResponse resultData = algorithmCameraService.batchOpening(batchOperateCameraParam);
        return resultData;
    }



    /**
     * 关闭摄像头
     */
    @PostMapping("onClose")
    @ApiOperation("关闭摄像头")
    @EnterPathParamLog
    public CommonResponse onClose(@RequestBody CameraIdBO cameraIdBO) {
        CommonResponse resultData = algorithmCameraService.onClose(cameraIdBO);
        log.info(resultData.toString());
        return resultData;
    }

    /**
     * 检测启动
     */
    @PostMapping("detectionStart")
    @ApiOperation("检测启动")
    public CommonResponse detectionStart() {
        CommonResponse resultData = algorithmCameraService.detectionStart();
        log.info(resultData.toString());
        return resultData;
    }

}
